from flask import Flask, url_for, redirect

app = Flask(__name__)
# url_for反解析

@app.route("/jingdong")
def jingdong():
    print(url_for("taobao",token=123))
    response = redirect(url_for("taobao",token=123))
    return response


@app.route("/yamaxun")
def yamaxun():
    response = redirect(url_for("taobao", token=456))
    return response

@app.route("/taobao/<int:token>")
def taobao(token):
    if token == 123:
        return "欢迎京东用户，给你打5折"
    elif token == 456:
        return "欢迎亚马逊用户，给你打9折"
    else:
        return "欢迎其他网站用户，给你打9.9折"

if __name__ == '__main__':
    app.run(debug=True)